package service.impl;

import com.github.pagehelper.PageHelper;
import mapper.UserInfMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import pojo.UserInf;
import service.UserInfService;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

/**
 * 用户业务层接口
 */
@Component("userService")
public class UserInfServiceImpl implements UserInfService {
    //引入mapper层
    @Resource(name = "userInfMapper")
    private UserInfMapper userInfMapper;
    @Override
    public int insert(UserInf userInf) {
        return userInfMapper.insert(userInf);
    }

    @Override
    public int updateById(UserInf userInf) {
        return userInfMapper.updateById(userInf);
    }

    @Override
    public int deleteById(Serializable id) {
        return userInfMapper.deleteById(id);
    }

    @Override
    public UserInf getById(Serializable id) {
        return userInfMapper.getById(id);
    }

    @Override
    public List<UserInf> getList(int current,int size) {
        //创建分页对象
        PageHelper.startPage(current,size);
        //查询
        List<UserInf> list = userInfMapper.getList();
        return list;
    }
}
